
# list_01=["宋","卢","吴"]
# list_02 =[32,30,27]
# dict_01 = dict(zip(list_01, list_02))
# print(dict_01)
# dict_new={}
# for key,value in zip(list_01,list_02):
#     dict_new[key]=value
# print(dict_new)
# dict_new1={ key:value for key,value in zip(list_01,list_02)}

# list01 = [43, "a", 5, True, 6, 7, 89, 9, "b"]
# # for item in list01 :
# #     if type(item) == (str):
# #         print(item)
# str_1=(item for item in list01 if type(item)==str )
# for item in str_1:
#     print(item)
# str_2=(item**2 for item in list01 if type(item)==int )
# for item in str_2:
#     print(item)

'''
        函数式编程
'''
# def fun1():
#     print("1")
# def fun2():
#     print("2")
# def fun3(a):
#     print("3")
#     a()
# fun3(fun1)
# fun3(fun2)
# print("=====================================")
# list01=[4,54,46,56,7,8]
# def gt10(num1):
#     for item in num1:
#         if item > 10:
#             return item
# print(gt10(list01))
# def let50(num1):
#     for item in num1:
#         if item < 50:
#             return item
# print(let50(list01))
# print("=====================================")
# def con01(nums):
#     return nums>10
# def con02(nums):
#     return nums<50
# def find_num(con,list):
#     for item in list:
#         if con(item):
#             return item
# print(find_num(con01,list01))
# print(find_num(con02,list01))
# print("=====================================")
# list01=[43,54,53,56,65,67]
# def con01(nums):
#     return nums % 2 != 0
# def con02(nums):
#     return nums % 3 == 0 or nums % 5 == 0
# def find_num(con,list):
#     for item in list:
#         if con(item):
#             return item
# print(find_num(con01,list01))
# print(find_num(con02,list01))

class Employee:

    def __init__(self, eid, did, name, money):
        self.eid = eid # 员工编号
        self.did = did # 部门编号
        self.name = name
        self.money = money
    def __str__(self):
       return f"员工姓名：{self.name}，部门编号：{self.did}，员工编号：{self.eid}，工资是：{self.money}元"

list_employees = [
    Employee(1001, 9002, "师父", 60000),
    Employee(1002, 9001, "孙悟空", 50000),
    Employee(1003, 9002, "猪八戒", 20000),
    Employee(1004, 9001, "沙僧", 30000),
    Employee(1005, 9001, "小白龙", 15000),
]

# def con1(a):
#     return a.did == 9002
# def con2(a):
#     return len(a.name) == 2

def find_all(condition):
    for item in list_employees:
        if condition(item):
            yield item

# for item in find_all(con1):
#     print(item)
# print("-----------------------")
# for item in find_all(con2):
#     print(item)

for item in find_all(lambda a: a.did==9002):
    print(item)
print("-----------------------")
for item in find_all(lambda a:len(a.name)==2):
    print(item)